package org.cbg.control;

import org.cbg.btn.TrslationBtn;
import org.cbg.frame.TrslationMainJframe;
import org.come.action.FromServerAction;
import org.come.until.CutButtonImage;
import org.come.until.GsonUtil;

import javax.swing.*;
import java.io.File;
import java.io.IOException;



public class SearchColectionStatuesResultControl implements FromServerAction {

    /**
     * 藏宝阁商品的收藏-取消
     */
    @Override
    public void controlMessFromServer(String mes, String type) {
        // TODO Auto-generated method stub


        /**
         * 处理返回来的消息
         */
        Integer colectionStatues = GsonUtil.getGsonUtil().getgson().fromJson(mes, Integer.class);

        /**
         * 1.表示收藏成功 2.表示收藏失败 3.表示取消收藏成功 4.取消收藏失败
         */
        TrslationBtn shoucang = (TrslationBtn) TrslationMainJframe.getTrslationMainJframe().getShoucangBtn();

        try {
            switch (colectionStatues) {
                case 1:
                    shoucang.setIcons(CutButtonImage.cuts("inkImg/number/b4/scxx.png"));
                    break;
                case 2:
                    shoucang.setIcons(CutButtonImage.cuts("inkImg/number/b4/qxscxx.png"));
                    break;
                case 3:
                    shoucang.setIcons(CutButtonImage.cuts("inkImg/number/b4/qxscxx.png"));
                    break;
                case 4:
                    shoucang.setIcons(CutButtonImage.cuts("inkImg/number/b4/scxx.png"));
                    break;

                default:
                    break;
            }
        } catch (Exception e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}
